package com.hejielife.balking1;

import java.util.Random;
/**
 * 2019年8月2日 下午1:19:03
 * 
 * @author hejielife
 * @despribe ChangerThread
 */
public class ChangerThread extends Thread {
	private Data data;
	private Random random = new Random();

	public ChangerThread(String name, Data data) {
		super(name);
		this.data = data;
	}

	public void run() {
		try {
			for (int i = 0; true; i++) {
				data.change("No." + i); // change
				Thread.sleep(random.nextInt(1000)); // sleep
				data.save(); // do save
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
